package com.shujia.day07.homework;

class Circle {
    private Double radius;

    public Circle(Double radius) {
        this.radius = radius;
    }

    public Circle() {
    }


    public double getArea() {
        return this.radius * this.radius * Math.PI;
    }    //获取圆的面积

    public double getPerimeter() {
        return 2 * this.radius * Math.PI;
    }        //获取圆的周长

    //将圆的关径、周长、面积输出到屏幕
    public void show() {
        System.out.println("半径：" + this.radius);
        System.out.println("周长：" + this.getPerimeter());
        System.out.println("面积：" + this.getArea());
    }
}

class Cylinder extends Circle {
    double height;

    public Cylinder(Double radius, double height) {
        super(radius);
        this.height = height;
    }

    double getVolume() {
        return super.getArea() * height;
    }    //获取圆柱体的体积

    //将圆柱体的体积输出到屏幕
    void showVolume() {
        System.out.println("圆柱体体积：" + getVolume());
    }
}

public class Test1 {
    public static void main(String[] args) {
        new Cylinder(3.0,4).showVolume();
        new Circle(3.0).show();
    }
}
